// 版权归 瞄你个汪 所有。使用本代码应遵守相关法律法规和Apache 2.0开源许可要求。
package top.geeke.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.JdbcType;
import top.geeke.entity.base.EntityBase;
import top.geeke.eunm.SysGenderEnum;
import top.geeke.eunm.SysPlatformTypeEnum;
import top.geeke.toolkit.supertable.annotation.SuperColumn;
import top.geeke.toolkit.supertable.annotation.SuperIndex;
import top.geeke.toolkit.supertable.annotation.SuperTable;

import java.io.Serializable;

/**
 * <p>
 * 系统微信用户表
 * </p>
 * @author 瞄你个汪
 * @since 2024-05-01 12:00:00
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "sys_wechat_user")
@SuperTable(value = "系统微信用户表", isSystem = true, indexes = {
        @SuperIndex(indexName ="sys_index_{table}_N", indexFields ="nickName"),
        @SuperIndex(indexName ="sys_index_{table}_M", indexFields ="mobile"),
})
public class SysWechatUser extends EntityBase implements Serializable {
    private static final long serialVersionUID = 1L;

    @SuperColumn(value = "用户ID")
    private Long userId;

    @SuperColumn(value = "平台类型")
    private SysPlatformTypeEnum platformType;

    @SuperColumn(value = "微信OpenId标识", length = 64)
    private String openId;

    @SuperColumn(value = "会话密钥", nullable = true, length = 256)
    private String sessionKey;

    @SuperColumn(value = "UnionId", nullable = true, length = 64)
    private String unionId;

    @SuperColumn(value = "昵称", nullable = true, length = 64)
    private String nickName;

    @SuperColumn(value = "头像", nullable = true, length = 256)
    private String avatar;

    @SuperColumn(value = "手机号码", nullable = true, length = 16)
    private String mobile;

    @SuperColumn(value = "性别", nullable = true)
    private SysGenderEnum sex;

    @SuperColumn(value = "语言", nullable = true, length = 64)
    private String language;

    @SuperColumn(value = "城市", nullable = true, length = 64)
    private String city;

    @SuperColumn(value = "城市", nullable = true, length = 64)
    private String province;

    @SuperColumn(value = "国家", nullable = true, length = 64)
    private String country;

    @SuperColumn(value = "AccessToken", columType = JdbcType.LONGVARCHAR, nullable = true)
    private String accessToken;

    @SuperColumn(value = "RefreshToken", columType = JdbcType.LONGVARCHAR, nullable = true)
    private String refreshToken;

    @SuperColumn(value = "过期时间", nullable = true)
    private Integer expiresIn;

    /**
     * 用户授权的作用域，使用逗号分隔
     */
    @SuperColumn(value = "授权作用域", nullable = true, length = 64)
    private String scope;

    @JsonIgnore
    @JsonIgnoreProperties
    @TableField(exist = false)
    private SysUser user;
}
